﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Ditto.Models.Comment>" %>

<% using (Html.BeginForm("New", "Comments", new { type = Model.Type, subjectID = Model.SubjectID }))
   {%>

    <div id="stars-new">
        <%: Html.HiddenFor(m => m.Rating )%>
    </div>
    <%: Html.TextAreaFor(m => m.Message, new { style = "width:97%;height:auto;padding:7px;margin:7px 0px 7px 0px;overflow:auto;display:block;float:left" })%>
    <div style="float:right;display:block">
        <input id="postcomment" type="submit" value="Post" style="padding:3px;font-size:medium"/>
    </div>
    <div style="clear:both"></div>
<%}%>

<script src="/Scripts/autoresize.jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $("#comments textarea").autoResize({
        // On resize:
        onResize: function () {
            $(this).css({ opacity: 0.8 });
        },
        // After resize:
        animateCallback: function () {
            $(this).css({ opacity: 1 });
        },
        // Quite slow animation:
        animateDuration: 300,
        // More extra space:
        extraSpace: 10
    });
</script>

<script type="text/javascript" src="/Scripts/raty/jquery.raty.js"></script>
<script type="text/javascript">
    $('#stars-new').raty({
    readOnly:	false,
    noRatedMsg: 'Please rate!',
    cancelHint: 'remove my rating!',
    cancelPlace: 'left',
        half: true,
        cancel: true,
        target: '#Rating',
        targetKeep: true,
        targetType: 'number'
    });
</script>